# import pywifi
# from pywifi import const
# import time
#
# def connect_wifi(ssid, password):
#     # 获取无线网卡接口
#     wifi = pywifi.PyWiFi()
#     iface = wifi.interfaces()[0]
#
#     # 断开所有连接
#     iface.disconnect()
#     time.sleep(1)
#
#     # 创建WiFi连接文件
#     profile = pywifi.Profile()
#     # 设置ssid（网络名称）
#     # print('ssid.encode(utf-8):'+ str(ssid.encode('utf-8')))
#     # print('ssid.encode(utf-8).decode(utf-8):' + ssid.encode('utf-8').decode('utf-8'))
#
#     profile.ssid = ssid.encode('utf-8').decode('gbk','ignore')
#     #profile.ssid = str(ssid.encode('utf-8'))#.decode('utf-8')
#
#     # 设置auth算法（一般为开放式）
#     profile.auth = const.AUTH_ALG_OPEN
#     # 设置加密算法（一般为wpa2）
#     profile.akm.append(const.AKM_TYPE_WPA2PSK)
#     # 设置加密单元（一般为ccmp）
#     profile.cipher = const.CIPHER_TYPE_CCMP
#     # 设置密码
#     profile.key = password.encode('utf-8').decode('utf-8')
#
#     # 删除所有网络配置文件
#     iface.remove_all_network_profiles()
#     # 设置新的连接文件
#     tmp_profile = iface.add_network_profile(profile)
#
#     print("11111")
#
#     # 连接
#     iface.connect(tmp_profile)
#     time.sleep(5)  # 等待5秒
#
#     # 判断是否连接成功
#     if iface.status() == const.IFACE_CONNECTED:
#         return True
#     else:
#         return False
#
# # 测试连接
# ssid = "test测试.."
# password = "123456sji"
#
# if connect_wifi(ssid, password):
#     print("连接成功！")
# else:
#     print("连接失败！")

# import tkinter as tk
# def change_text():
#     button.config(text="新文字")
# root = tk.Tk()
# root.title("改变按钮文字示例")
# labelframe = tk.LabelFrame(width=400, height=200, text="配置")
# labelframe.grid(column=0, row=0, padx=10, pady=10)
# # pojie = tk.Button(labelframe, text="开始破解", command=change_text).grid(column=1, row=0)
# # if (pojie == None):
# #     print("NULL")
#
# button = tk.Button(labelframe, text="原始文字", command=change_text)
# button.grid(column=1, row=0)
# if(button == None):
#     print("None")
# # button.pack(pady=20)
# root.mainloop()

import threading
import time

a = 5

def test(a):
    # while True:
        print('我是子线程')
        time.sleep(5)
def thread_start():
    thread = threading.Thread(target=test)
    thread.start()
    print("h1")

# thread_start()

thread = threading.Thread(target=test,args=[a,])
thread.start()
print("h2")
for i in range(5):
    print('我是主线程')
    time.sleep(1)


# import threading
# import time
#
# a = 5
#
# def test(a):
#     while True:
#         print('我是子线程', a)
#         time.sleep(5)
#
# thread = threading.Thread(target=test(a))
# thread.start()
# print("a1")
# for i in range(5):
#     print('我是主线程')
#     time.sleep(1)

